namespace Nintest.Collections
{
    using System.Collections;
    using System.Collections.Generic;

    public class Grouping<TKey, TElement> : IMutableGrouping<TKey, TElement>
    {
        public Grouping(TKey key)
        {
            Key = key;
            Values = new List<TElement>();
        }

        public TKey Key { get; private set; }

        private IList<TElement> Values { get; set; }

        public void Add(TElement element)
        {
            Values.Add(element);
        }

        public IEnumerator<TElement> GetEnumerator()
        {
            return Values.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}